作業ログ | scrapbox-bundler
from scrapbox-bundler
2021-11-29
✅scrapbox-bundlerのdeploy先をgithub pagesからvercelに変える
14:56:29 試しにvercelにdeployしてみている
cd ~/git/scrapbox-bundler && vercelでpreview deploymentを作れる
Build & Development Settingsをいじった
build command: /vercel/.deno/bin/deno bundle build.worker.ts > assets/worker.js && /vercel/.deno/bin/deno bundle App.tsx > assets/index.js
install command: curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.16.3
うまく動いた
https://scrapbox-bundler-bep73hfxp-takker99.vercel.app
github pagesのようなURL parametersの制限もないし、こっちに移行しようかな
2021-11-15
10:57:47 entry pointとimport mapの読み込みをlog表示するようにしたhttps://github.com/takker99/scrapbox-bundler/commit/5836a100159053e582a4a627b5906ee55871d88e
10:57:36 ✅entry pointのURLをreloadで再読み込みで来ていない
2021-11-11
21:09:54 done commithttps://github.com/takker99/scrapbox-bundler/commit/f36890ca9fd9864b38b85e1bfc26d5da8ff797e3
19:16:46 relative()の挙動がおかしいような
生成される相対パスが深すぎる
テスト書くか。
19:27:34 アルゴリズムが微妙に違っている
通りでおかしいわけだ
書き直すか。
相対URLの書式
20:59:20 実装完了
testも少し書いた
deno packageとして切り出して公開しても良さそう
公開する前に、URL parameterの処理とかを入れなければならないが
いろいろなURL (Web API)操作方法を入れる必要がある
21:03:19 bundleも確認した
commit&pushしたら今度こそおしまいだ。
19:16:22 from-programming-notesのbundleを設定してた
externalを追加したり
18:49:15 externalはurlからの相対パスでも指定できるようにするか
毎回絶対パスで指定するの面倒だし
17:24:15 import mapをやっていた
ImportMapに合うようなType assersionを作っていた
型エラーが出ないように書くのが非常に難しい
法則がわからない
ていうかdeno_x/importmapに型判定函数があった……
これ使えばよかったか
ちゃんと書けたかどうか確かめるために、testも書いておいた
案の定バグが見つかった。未然に防げてよかった
17:34:43 試す
http://localhost:4507/?url=https://scrapbox.io/api/code/takker/from-programming-notes/index.js&run&bundle&importmap=https://scrapbox.io/api/code/takker/from-programming-notes/importmap.json
18:00:50 scopes (import map)をうまく処理できない
deno x/importmapの処理がおかしい?
scopesの使用はやめよう。
18:09:17 https://esm.sh/@progfay/scrapbox-parser@7.1.0 で使っているコードを読み込めていない
なぜだ?他のscrapbox.ioからのコードはimport経由で読めているというのに。
18:13:10 http://localhost:4507/?url=https://esm.sh/@progfay/scrapbox-parser@7.1.0&bundle&run を試したら、こんなコードが生成された
code:log
// <stdin>
var stdin_default = '/* esm.sh - @progfay/scrapbox-parser@7.1.0 */\nexport * from "https://cdn.esm.sh/v57/@progfay/scrapbox-parser@7.1.0/es2021/scrapbox-parser.js";\n';
export {
stdin_default as default
};
もしかしてjsではなくtext fileとして読み込まれている?
てことは、getLoader()に不具合があるのか
esm.shのresponse結果を見てみよう
18:17:19 ビンゴ。text loaderが読み込まれていた
18:20:01 esm.shのresponseにはちゃんとcontent-typeが指定されている……
なんでjsだと認識できていないんだ?
18:20:55 あ、content-typeからファイル種別を取得するコードを書き損じていた
そりゃ読み込まれないわな
18:37:42 読み込まれた!
15:02:33 esbuildのbuild中に発生したエラーも表示できるようにしたhttps://github.com/takker99/scrapbox-bundler/commit/f8d194712c4c9050d9aa2a5cb3835fa8624c3f98
14:16:15 externalを実装中
http://localhost:4507/?url=https://scrapbox.io/api/code/takker/import/common.js&external=https://scrapbox.io/api/code/takker-memex/GYAZO_ACCESS_TOKEN/auth.js&run&bundle
14:23:14 できたhttps://github.com/takker99/scrapbox-bundler/commit/00fde6daa90a0975da755a21028413f76e76e8ee
ここで一旦commitするか
した
14:23:23 externalのパスを、import mapなどを解決した後のパスに書き換えたいな
15:14:54 これは無理そう
external: trueと一緒にpath: "..."を返したら書き換えられた!
2021-11-22 09:56:24 esbuildのissueにも出てた
16:09:06 終了
deno_std/pathのrelative()で相対パスに解決しようとしたら、Denoに依存していたせいでbuildに失敗してしまった
最初原因が全くわからず困惑した
仕方ないので、Denoを使った処理に改造したコードを使った
16:17:07 pushしたhttps://github.com/takker99/scrapbox-bundler/commit/e23789e7cb4c68529791e420b94da12483d296ff
#2021-12-05 09:25:11
#2021-11-27
#2021-11-15
#2021-11-11